import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.Date;
import static org.junit.jupiter.api.Assertions.*;
public class UserTest {
    private User user;
    @BeforeEach
    void setUp() {
        // 实例化 User，注意构造器参数要和 User 类定义匹配
        // 假设 User 类构造器是：(userId, username, password, registerTime, userType, phone)
        user = new User("1", "testUser", "123456", new Date(), UserType.MANAGER, "1234567890") {
            @Override
            public void login() {}
            @Override
            public void logout() {}
            @Override
            public void managePassword() {}
        };
    }
    @Test
    void getUserIdTest() {
        assertEquals("1", user.getUserId());
    }
    @Test
    void usernameGetterAndSetterTest() {
        user.setUsername("newTestUser");
        assertEquals("newTestUser", user.getUsername());
    }
    @Test
    void passwordGetterAndSetterTest() {
        user.setPassword("newPassword");
        assertEquals("newPassword", user.getPassword());
    }
    @Test
    void getRegisterTimeTest() {
        assertNotNull(user.getRegisterTime());
    }
    @Test
    void getUserTypeTest() {
        assertEquals(UserType.MANAGER, user.getUserType());
    }
    @Test
    void phoneGetterTest() {
        assertEquals("1234567890", user.getPhone());
    }
}
